#ifndef BASEOBJECT_HPP
#define	BASEOBJECT_HPP

#include <cstring>
#include "Types.hpp"
#include "Scripting/Scriptable.hpp"

/**
 * Base class for objects;
 */
class BaseObject: public Scriptable{
protected:
    
public:

    /** Codes for destroy state of an object. */
    enum DestroyState{
        /** Object should not be destroyed. */
        d_Clean = 0,
        /** Object has been marked to be destroyed on next update call.*/
        d_Destroy = 1,
        /** Object has been destroyed and must be deleted on next update call. */
        d_Delete = 2,
    };

    /**
     * Does the object have a lua script. The value is resolved automatically
     * when a script is loaded by ObjectManager. This member has to be registered
     * in lua with the same name.
     * If this value is false then the updateable flag is of no use.
     */
    bool hasScript;

    /** Does this object require an update call. */
    bool updateable;

    /**
     * Flag marking that this object should be removed from the world
     * in the next few updates. An object cannot be removed from the
     * world instantly since it might be in use by other objects and classes,
     * and must be removed from them before it can be deleted.
     */
    byte destroy;

    /** Name of script associated with object. */
    char script[OBJECT_SCRIPT_LENGTH+1];

    /** The index of this entity in its respective entity list.*/
    uint16_t index;

    BaseObject();
    virtual void init(const char* s, uint16_t i);
    virtual void setScript(const char* s);
};


#endif